<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%--日期格式化--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>问题详情</title>
    <meta name="keywords" content="前端模板">
    <meta name="description" content="前端模板">

    <script src="/static/js/jquery/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="/static/layui/layui.js" type="text/javascript"></script>
    <script src="/static/js/index/index.js" type="text/javascript"></script>
    <script src="/static/js/index/freezeheader.js" type="text/javascript"></script>
    <script src="/static/layui/lay/modules/layer.js" type="text/javascript"></script>
    <script src="/static/js/index/sliders.js" type="text/javascript"></script>
    <script src="/static/js/index/html5.js" type="text/javascript"></script>
    <script src="/static/js/index/article_details.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/layui/css/modules/layer/default/layer.css"/>
    <link rel="stylesheet" href="/static/layui/font/iconfont.woff2"/>
    <link rel="stylesheet" href="/static/layui/font/iconfont.woff"/>
    <link rel="stylesheet" href="/static/layui/font/iconfont.ttf"/>
    <link rel="stylesheet" href="/static/layui/css/modules/layer/default/layer.css"/>
    <link rel="stylesheet" href="/static/css/global.css"/>
    <!--
    -->
</head>
<body>

<div class="layui-header header">
    <div class="main">
        <ul class="layui-nav layui-nav-left" lay-filter="filter">
            <%--<a  href="index.html" title="课程学习问答系统"><img class="logo" src="../static/images/logo1.png"></a>--%>
            <img src="/static/images/logo1.png"/>
            <li class="layui-nav-item layui-this nav-left">
                <a href="/student/">首页</a>
            </li>
            <li class="layui-nav-item">
                <a href="/student/team">师资队伍</a>
            </li>
            <li class="layui-nav-item">
                <a href="/student/article">文章库</a>
            </li>

        </ul>
        <ul class="layui-nav layui-layout-right layui-nav-right" lay-filter="filter">

            <li class="layui-nav-item">
                <a href="/student/question">我的<span class="layui-badge-dot"></span></a>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;"><img src="/static/images/head.jpg" class="layui-nav-img">个人中心</a>
                <dl class="layui-nav-child">
                    <dd><a href="/student/set">查看个人资料</a></dd>
                    <dd><a href="/student/logout">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
</div>
<div class="layui-container container">
    <div class="layui-row layui-col-space20">
        <div class="layui-col-md">
            <div>
          <span class="layui-breadcrumb">
              <a href="/student/index">首页</a>
              <a href="/student/article">问题</a>
              <a><cite>问题:${question.questionId}</cite></a>
    	</span>
                <hr class="layui-bg-red">
                <div class="content" id="photos">
                    <p class="box_c"><span class="d_time">发布时间：<fmt:formatDate value="${question.questionTime}"
                                                                               pattern="yyyy-MM-dd HH:mm:ss"/></span><span>编辑：学生 ${question.questionQuizzerName}</span>
                    </p>
                    <div class="detail-body">
                        <p>${question.questionText}
                         </p>
                        <a href="/download/${question.questionId}"><img src="/images/${question.questionPicName}" alt="图片未添加"/></a>



                    </div>
                    <%--回答--%>
                    <hr class="layui-bg-green" style="height:2px;">
                    <div class="layui-inline fly-home-da">
                        <div class="fly-panel">
                            <h3 class="fly-panel-title">回答</h3>
                            <ul class="home-jieda">
                                <c:forEach items="${answerList}" var="answer">
                                    <li>
                                        <p>
                                            老师 ${answer.answerResponderName} 回答了
                                            <a><cite>问题:${question.questionId}</cite></a>这个问题
                                        </p>

                                        <div class="home-dacontent">
                                            回答内容
                                            <pre> ${answer.answerText}
                                             <a href="/answer/download/${answer.answerId}"><img src="/aImage/${answer.answerPicName}" alt="图片未添加"/></a>
</pre>
                                        </div>
                                    </li>

                                </c:forEach>
                            </ul>
                            <!-- <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><span>没有回答任何问题</span></div> -->
                        </div>
                    </div>
                    <fieldset class="layui-elem-field layui-field-title" style="margin: 0px 0px; text-align: center;">
                        <legend>评论</legend>
                    </fieldset>
                    <div class="detail-box">
                        <a name="comment"></a>
                        <ul class="jieda" id="jieda">
                            <c:forEach items="${commentList}" var="comment">


                                <li data-id="12" class="jieda-daan">
                                    <a name="item-121212121212"></a>
                                    <div class="detail-about detail-about-reply">
                                        <a class="jie-user" href="">
                                            <img src="/static/images/default.png" alt="">

                                            <cite>
                                                <i>${comment.commentReviewName}</i>
                                                <c:set var="flag" scope="session"
                                                       value="${comment.commentType}"></c:set>
                                                <c:if test="${flag==0}">
                                                    <em style="color:#999">（学生）</em>

                                                </c:if>
                                                <c:if test="${flag==1}">
                                                    <em style="color:#999">（老师）</em>
                                                </c:if>
                                            </cite>
                                        </a>
                                        <div class="detail-hits">
                                            <span><fmt:formatDate value="${comment.commentTime}"
                                                                  pattern="yyyy-MM-dd HH:mm:ss"/></span>
                                        </div>
                                            <%--<i class="iconfont icon-caina" title="最佳答案"></i>--%>
                                    </div>
                                    <div class="detail-body jieda-body">
                                        <p>${comment.commentContent}</p>
                                    </div>
                                    <div class="jieda-reply">
                                            <%-- <span class="jieda-zan zanok" type="zan"><i
                                                     class="iconfont icon-zan"></i><em>12</em></span>--%>
                                        <span type="reply"><i class="iconfont icon-svgmoban53"></i>
                                            <a class="reply" data-commentid="${comment.commentId}"
                                               data-commentnickname="${comment.commentReviewName}"
                                               onclick="reply(this)">回复</a>

                                                </span>
                                    </div>

                                </li>
                            </c:forEach>
                        </ul>
                        <!--分页-->
                        <%--<div id="page_reply"></div>--%>

                        <form class="layui-form " style="text-aglin:center;" action="/comment/insert">

                            <div class="layui-form layui-form-pane">
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
                                        <input type="hidden" name="questionId" id="questionId"
                                               value="${question.questionId}"/>
                                    </div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
                                        <input type="hidden" name="parentCommentId" id="parentCommentId" value="-1"/>
                                    </div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <div class="layui-input-block">
                                        <textarea id="replyComment" name="reply" lay-verify="reply"
                                                  class="layui-textarea fly-editor"></textarea>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <input type="submit" class="layui-btn" lay-filter="*"
                                           lay-submit value="发布评论"/>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<div class="footer">
    <hr class="layui-bg-red">
    <p><a href="http://itdaima.com/">课程学习问答系统</a> 2021 &copy; </p>
    <p>课程学习问答系统</p>
</div>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
    function reply(obj) {
    $(document).ready(function() {
         $("#replyComment").empty();
            var commentnickname = obj.getAttribute("data-commentnickname");
            var CommentId = obj.getAttribute("data-commentid");
            var content = '对@' + commentnickname+'的回复:';
            /*document.getElementById('parentCommentId').value = CommentId;

            var el = document.getElementById('reply'); //设置textarea的值
            document.getElementById('reply').innerHTML=content;
            el.value = content+"回复";*/
            alert(content);
          //  $("#replyComment").append(content);

        $("#replyComment").attr('placeholder',content);

    });
    }
</script>
</body>
</html>
